package com.dusk.service.impl;

import com.dusk.dao.UserMapper;
import com.dusk.pojo.User;
import com.dusk.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;


    //根据id查询
    @Override
    public User queryUserById(int id) {
        return userMapper.queryUserById(id);
    }

    //根据登录名查询用户
    @Override
    public User queryUserByAccount(String userAccount) {
        return userMapper.queryUserByAccount(userAccount);
    }

    //修改用户信息根据id
    @Override
    public int updateUser(int id, String userName, String address, String sex, String tel, String mail, Date updateTime, String password,String headImage) {
        return userMapper.updateUser(id, userName, address, sex, tel, mail, updateTime,
                password,headImage);
    }

    @Override
    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public int queryAllUserCount() {
        return userMapper.queryAllUserCount();
    }

    @Override
    public int updateUserPassword(String userAccount, String mail, String passWord) {
        return userMapper.updateUserPassword(userAccount, mail, passWord);
    }
}
